package cn.wizzer.app.user.modules.models;


import cn.wizzer.app.user.modules.models.enums.WithdrawChannel;
import cn.wizzer.app.user.modules.models.enums.WithdrawStatusEnum;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
@Table("user_withdraw")
@TableIndexes({@Index(name = "INDEX_CT_AT", fields = {"ctAt"}, unique = false),
        @Index(name = "unique_no", fields = {"no"}, unique = true)})
public class UserWithdraw extends BaseModel implements Serializable {

    @Column
    @Name
    @Comment("ID")
    @J4EIgnore
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(uu32 = true)
    private String id;

    @Column
    @Comment("币种ID,新增设置不可修改")
    @ColDefine(type = ColType.VARCHAR, width = 50,notNull = true)
    private String currencyId;

    @Column
    @Comment("用户ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String userId;

    @Column
    @Comment("单号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String no;

    @Column
    @Comment("银行卡id")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String cardId;

    @Column
    @Comment("金额")
    @ColDefine(type=ColType.FLOAT, width=16, precision=6)
    private BigDecimal amount;

    @Column
    @Comment("实际金额（扣手续费后）")
    @ColDefine(type=ColType.FLOAT, width=16, precision=6)
    private BigDecimal realAmount;

    @Column
    @Comment("状态->-1:取消0:待确认1:待到账2:成功3:失败")
    @ColDefine(type=ColType.VARCHAR, width=32)
    private WithdrawStatusEnum status;

    @Column
    @Comment("第三方平台单号")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String outNo;

    @Column
    @Comment("通道")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private WithdrawChannel channel;


    @Column
    @Comment("备注")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String remark;

    @Column
    @Comment("银行卡号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String cardNumber;

    @Column
    @Comment("收款人")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String accountName;

    @Column
    @Comment("银行")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private String bank;

    @Column
    @Comment("银行LibID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String bankLibId;

    @Column
    @Comment("国家")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private String country;

    @Column
    @Comment("取消时间")
    private Long cancelAt;

    @Column
    @Comment("审批时间")
    private Long examineAt;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;

    @Column
    @Comment("到账时间")
    private Long transferAt;
}
